<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>属性操作</title>
    <style>
        .aColor{
            color: blue;
        }
    </style>
</head>
<body>
    <a>哔哩哔哩</a>
</body>
    <script>
        //1. setAttribute()  添加属性
       let a = document.getElementsByTagName("a")[0];
        a.setAttribute("href","https://www.bilibili.com/");

        //2.getAttribute()  获取
        let value = a.getAttribute("href");
        //alert(value);
        
        //3.removeAttribute() 删除
        //a.removeAttribute("href");

        //4.style  添加样式
        //a.style.color="green";

        //5.className  添加指定样式
        a.className="aColor";

    </script>
</html>